package uscdb.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@Table(name = "tlogicfile")
@DynamicInsert(true)
@DynamicUpdate(true)
public class Tlogicfile implements java.io.Serializable {

	private static final long serialVersionUID = 3232836527339251108L;
	private String id;
	
	/**
	 * logic的文件名
	 */
	private String fileName;

	/**
	 * 属于该logic文件的逻辑
	 */
	private Set<Tlogic> tlogicSet = new HashSet<Tlogic>();
	/**
	 * 该logic文件的摘要，表明该logic文件的功能
	 */
	private String summary;
	/**
	 * 一个文件只属于一个版本
	 */
	private Tversion tversion;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TVERSION_ID")
	public Tversion getTversion() {
		return tversion;
	}

	public void setTversion(Tversion tversion) {
		this.tversion = tversion;
	}

	@Column(name = "fileName")
	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	@Column(name = "summary", length = 1000)
	public String getSummary() {
		return summary;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "tlogicfile")
	public Set<Tlogic> getTlogicSet() {
		return tlogicSet;
	}

	public void setTlogicSet(Set<Tlogic> tlogicSet) {
		this.tlogicSet = tlogicSet;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 36)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	
}
